package aufgabe1;

import java.util.ArrayList;

/**
* is needed to manage Course-objects, such as adding new courses and listing them
* @author Lukas Koell
* @author David Medenjak
* @author Johannes Riedmann
*/
public class CourseManager implements java.io.Serializable{
   
	/**
	 * Serialization
	 */
	private static final long serialVersionUID = 1462796725139412649L;
	
	
	/** contains all added courses */
   private ArrayList<Course> courses;
   
   public CourseManager(){
	   courses = new ArrayList<Course>();
   }
   
   /**
    * adds a course to the courses-Array
    * @param course that will be added
    */
   public void addCourse(Course course){
       courses.add(course);
   }
   
   /**
    * lists all existing courses
    * @return a String list of existing courses
    */
   public String listCourses(){
	   String list = new String();
	   list += "Nr.\tTitel\t\tfr. Anmeldetermin\tsp. Anmeldetermin\tsp. Abmeldetermin\tangemeldet\n";
	   for(int i = 0; i < courses.size(); i++){
		   list += courses.get(i);
	   }
       return list;
   }
}
